﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Admin.aspx.cs" Inherits="OpenRAMS.Admin.Admin" %>
<%@ Import Namespace="OpenRAMS.Model" %>

<!DOCTYPE html />

<html>
<head runat="server">
    <title>OpenRAMS - Support Admin</title>
    <link rel="Stylesheet" type="text/css" href="../Include/default.css" />
</head>
<body>
    <form id="form1" runat="server">
    <table width="100%" class="tableDefault">
    <tr>
    <td align="center"><div class="tableTitle">Support Staff Portal</div>
    <div class="navBar">
    <a href="../Staff/Staff.aspx" class="navLink" target="_parent">Home</a> 
    <a href="addUser.aspx" class="navLink" target="_parent">Add User</a>
    <a href="../Staff/logout.aspx" class="navLink">Logout</a>
    </div>
    </td>
    </tr>
    <tr>
    <td>
    <marquee behavior="scroll" direction="left" class="newsFlash">
    <% 
        Response.WriteFile(Server.MapPath("~/Include/newsflash/admin.txt"));
     %>    
     </marquee>
    </td>
    </tr>
    <tr>
    <td width="100%">
    <table width="100%">
    <tr class="tableTitle"><td align="center">User List</td></tr>
    <tr>
    <td class="tableBody" width="100%">
    <table width="100%">
    

    <%
        Users usrs = new Users();
        int test = usrs.Populate("wontExist", "");
        List<UserRecord> userList = usrs.getUserList();
        int loopCount = 0;
        foreach (UserRecord u in userList)
        {
            Response.Write("<tr><td>");
            Response.Write("<a href=\"mailto:" + u.userEmail + "\">");
            Response.Write(u.userFirstName + " " + u.userSecondName);
            Response.Write("</a></td><td>");
            Response.Write("<a href=\"addUser.aspx?uID=\'");
            String uNameFix = u.userName.Replace(" ", "%20");
            Response.Write(uNameFix);
            Response.Write("\'\">Edit</a>");
            Response.Write("</td></tr>");
            if (loopCount <= userList.Count() - 1)
            {
                Response.Write("<tr><td colspan=\"2\"><hr /></td></tr>");
            }
            loopCount++;
        }
        
        
         %>

    </table>
    </td>
    </tr>
    </table>
    </td>
    </tr>
   
    <tr><td>
    <div class="footer">
    <% 
        Response.WriteFile(Server.MapPath("~/Include/footer.txt"));
    %>
    </div>
    </td></tr>
    <tr>
    <td>
    
    </td>
    </tr>
    </table>
    </form>
</body>
</html>
